package com.my.hzb.user.ctrl;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Test {

	@RequestMapping("/test")
	@ResponseBody
	public String test(HttpServletResponse response){
//		response.addHeader("Access-Control-Allow-Origin", "*");
		Cookie c2 = new Cookie("password","123");
		//设置生命周期为1小时，秒为单位
		c2.setMaxAge(3600);
		response.addCookie(c2);

		return "{s:12}";
	}
	@RequestMapping(value="/test1")
	public String test1(){
		return "login";
	}
}
